package com.test1230am;

public class Test17 {
    public static void main(String[] args) {
        // (17)
        // 定义实现m方法：在arr中找出指定元素的下标、如果没有元素、则返回-1
        int a = 2;
        int[] arr = {1,2,3,4,5};
        int b = m(arr, a);
        System.out.println(b);
    }
    public static int m(int[] arr,int a){
        int index =-1;
        for(int i =0;i<arr.length;i++){
            if(a==arr[i]){
                index = i;
            }
        }
        return index;
    }
}
